
		

-- D:\GOA\reslibrary\templete\res\modal\modalmgr.xsl 58
gr_module("gm_xinbanchunzhongyun")


mcgfscriptprocesssteppricemgr = inherit(GmSql.list,GmBase.CallBack):name("mcgfscriptprocesssteppricemgr")



mcgfscriptprocesssteppricemgr.init = function (self,pagecount)

	local top = self
	
	
	GmSql.list.init(self,gInfo["path"]..'/'..g_local_db_name,'czy_scriptprocessstepprice')
	GmBase.CallBack.init(self)
	
	self.baseurl = ''

	self.idPair = {}
	self.idPair['prev'] = '0'
	self.idPair['next'] = '0'
	
	self.pageCount = pagecount or 10
	self.totalPage = 0
	
	self:reset_maxminid('czy_scriptprocessstepprice','id')
	
	
	self.action = {}
	self.op  = {}
	
	
	
	-----------------------------
	self.action['cgfscriptprocesssteppricemodify'] = {} 	
	-------
	self.op['cgfscriptprocesssteppricemodify'] = function(postparam,ui)
	
		local net = GmBase.czynet.get_instance()		
		local newpostparam = {}
		local tbname,callbackey,newpostparam = net:cgfscriptprocesssteppricemodify()
		for a,b in pairs(top.action['cgfscriptprocesssteppricemodify']) do
			if postparam[a] ~= nil then
				newpostparam[a] = postparam[a]
			end
		end
		net:add_callback(callbackey,ui)	
		local tb,callbackey = net:cgfscriptprocesssteppricemodify(newpostparam)
		
	end	
		
  self.action['cgfscriptprocesssteppricemodify']['id'] = { ['title'] = '编号' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '8' }	
  self.action['cgfscriptprocesssteppricemodify']['photo_id'] = { ['title'] = '鍥剧墖瀵瑰簲鐨勫晢鍝乮d' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricemodify']['step_id'] = { ['title'] = '鍔犲伐鐜妭id' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricemodify']['step_name'] = { ['title'] = '鐜妭鍚?' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '30' }	
  self.action['cgfscriptprocesssteppricemodify']['step_price'] = { ['title'] = '鐜妭浠锋牸' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricemodify']['disable'] = { ['title'] = '1璇ョ幆鑺備笉瀛樺湪' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }	
  self.action['cgfscriptprocesssteppricemodify']['quantity'] = { ['title'] = 'quantity' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricemodify']['son_count'] = { ['title'] = '鍒嗗崟鏁伴噺' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricemodify']['condition'] = { ['title'] = '璁′欢鏉′欢' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricemodify']['priority'] = { ['title'] = 'priority' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricemodify']['line'] = { ['title'] = 'line' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '2' }	
  self.action['cgfscriptprocesssteppricemodify']['line_condition'] = { ['title'] = 'line_condition' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricemodify']['disable_sub'] = { ['title'] = 'disable_sub' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }
  self.action['cgfscriptprocesssteppricemodify']['list_source'] = { ['title'] = '' ,['t'] = 's' , ['max'] = 50 }
	
	-----------------------------
	self.action['cgfscriptprocesssteppricelist'] = {} 	
	-------
	self.op['cgfscriptprocesssteppricelist'] = function(postparam,ui)
	
		local net = GmBase.czynet.get_instance()		
		local newpostparam = {}
		local tbname,callbackey,newpostparam = net:cgfscriptprocesssteppricelist()
		for a,b in pairs(top.action['cgfscriptprocesssteppricelist']) do
			if postparam[a] ~= nil then
				newpostparam[a] = postparam[a]
			end
		end
		net:add_callback(callbackey,ui)	
		local tb,callbackey = net:cgfscriptprocesssteppricelist(newpostparam)
		
	end	
		
  self.action['cgfscriptprocesssteppricelist']['id'] = { ['title'] = '编号' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '8' }	
  self.action['cgfscriptprocesssteppricelist']['photo_id'] = { ['title'] = '鍥剧墖瀵瑰簲鐨勫晢鍝乮d' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricelist']['step_id'] = { ['title'] = '鍔犲伐鐜妭id' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricelist']['step_name'] = { ['title'] = '鐜妭鍚?' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '30' }	
  self.action['cgfscriptprocesssteppricelist']['step_price'] = { ['title'] = '鐜妭浠锋牸' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricelist']['disable'] = { ['title'] = '1璇ョ幆鑺備笉瀛樺湪' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }	
  self.action['cgfscriptprocesssteppricelist']['quantity'] = { ['title'] = 'quantity' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricelist']['son_count'] = { ['title'] = '鍒嗗崟鏁伴噺' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricelist']['condition'] = { ['title'] = '璁′欢鏉′欢' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricelist']['priority'] = { ['title'] = 'priority' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricelist']['line'] = { ['title'] = 'line' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '2' }	
  self.action['cgfscriptprocesssteppricelist']['line_condition'] = { ['title'] = 'line_condition' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricelist']['disable_sub'] = { ['title'] = 'disable_sub' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }
  self.action['cgfscriptprocesssteppricelist']['list_source'] = { ['title'] = '' ,['t'] = 's' , ['max'] = 50 }
	
	-----------------------------
	self.action['cgfscriptprocesssteppricedetail'] = {} 	
	-------
	self.op['cgfscriptprocesssteppricedetail'] = function(postparam,ui)
	
		local net = GmBase.czynet.get_instance()		
		local newpostparam = {}
		local tbname,callbackey,newpostparam = net:cgfscriptprocesssteppricedetail()
		for a,b in pairs(top.action['cgfscriptprocesssteppricedetail']) do
			if postparam[a] ~= nil then
				newpostparam[a] = postparam[a]
			end
		end
		net:add_callback(callbackey,ui)	
		local tb,callbackey = net:cgfscriptprocesssteppricedetail(newpostparam)
		
	end	
		
  self.action['cgfscriptprocesssteppricedetail']['id'] = { ['title'] = '编号' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '8' }	
  self.action['cgfscriptprocesssteppricedetail']['photo_id'] = { ['title'] = '鍥剧墖瀵瑰簲鐨勫晢鍝乮d' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricedetail']['step_id'] = { ['title'] = '鍔犲伐鐜妭id' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricedetail']['step_name'] = { ['title'] = '鐜妭鍚?' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '30' }	
  self.action['cgfscriptprocesssteppricedetail']['step_price'] = { ['title'] = '鐜妭浠锋牸' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricedetail']['disable'] = { ['title'] = '1璇ョ幆鑺備笉瀛樺湪' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }	
  self.action['cgfscriptprocesssteppricedetail']['quantity'] = { ['title'] = 'quantity' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricedetail']['son_count'] = { ['title'] = '鍒嗗崟鏁伴噺' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricedetail']['condition'] = { ['title'] = '璁′欢鏉′欢' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricedetail']['priority'] = { ['title'] = 'priority' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricedetail']['line'] = { ['title'] = 'line' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '2' }	
  self.action['cgfscriptprocesssteppricedetail']['line_condition'] = { ['title'] = 'line_condition' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricedetail']['disable_sub'] = { ['title'] = 'disable_sub' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }
  self.action['cgfscriptprocesssteppricedetail']['list_source'] = { ['title'] = '' ,['t'] = 's' , ['max'] = 50 }
	
	-----------------------------
	self.action['cgfscriptprocesssteppricepost'] = {} 	
	-------
	self.op['cgfscriptprocesssteppricepost'] = function(postparam,ui)
	
		local net = GmBase.czynet.get_instance()		
		local newpostparam = {}
		local tbname,callbackey,newpostparam = net:cgfscriptprocesssteppricepost()
		for a,b in pairs(top.action['cgfscriptprocesssteppricepost']) do
			if postparam[a] ~= nil then
				newpostparam[a] = postparam[a]
			end
		end
		net:add_callback(callbackey,ui)	
		local tb,callbackey = net:cgfscriptprocesssteppricepost(newpostparam)
		
	end	
		
  self.action['cgfscriptprocesssteppricepost']['id'] = { ['title'] = '编号' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '8' }	
  self.action['cgfscriptprocesssteppricepost']['photo_id'] = { ['title'] = '鍥剧墖瀵瑰簲鐨勫晢鍝乮d' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricepost']['step_id'] = { ['title'] = '鍔犲伐鐜妭id' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricepost']['step_name'] = { ['title'] = '鐜妭鍚?' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '30' }	
  self.action['cgfscriptprocesssteppricepost']['step_price'] = { ['title'] = '鐜妭浠锋牸' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricepost']['disable'] = { ['title'] = '1璇ョ幆鑺備笉瀛樺湪' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }	
  self.action['cgfscriptprocesssteppricepost']['quantity'] = { ['title'] = 'quantity' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricepost']['son_count'] = { ['title'] = '鍒嗗崟鏁伴噺' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricepost']['condition'] = { ['title'] = '璁′欢鏉′欢' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricepost']['priority'] = { ['title'] = 'priority' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppricepost']['line'] = { ['title'] = 'line' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '2' }	
  self.action['cgfscriptprocesssteppricepost']['line_condition'] = { ['title'] = 'line_condition' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppricepost']['disable_sub'] = { ['title'] = 'disable_sub' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }
  self.action['cgfscriptprocesssteppricepost']['list_source'] = { ['title'] = '' ,['t'] = 's' , ['max'] = 50 }
	
	-----------------------------
	self.action['cgfscriptprocesssteppriceitem'] = {} 	
	-------
	self.op['cgfscriptprocesssteppriceitem'] = function(postparam,ui)
	
		local net = GmBase.czynet.get_instance()		
		local newpostparam = {}
		local tbname,callbackey,newpostparam = net:cgfscriptprocesssteppriceitem()
		for a,b in pairs(top.action['cgfscriptprocesssteppriceitem']) do
			if postparam[a] ~= nil then
				newpostparam[a] = postparam[a]
			end
		end
		net:add_callback(callbackey,ui)	
		local tb,callbackey = net:cgfscriptprocesssteppriceitem(newpostparam)
		
	end	
		
  self.action['cgfscriptprocesssteppriceitem']['id'] = { ['title'] = '编号' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '8' }	
  self.action['cgfscriptprocesssteppriceitem']['photo_id'] = { ['title'] = '鍥剧墖瀵瑰簲鐨勫晢鍝乮d' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppriceitem']['step_id'] = { ['title'] = '鍔犲伐鐜妭id' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppriceitem']['step_name'] = { ['title'] = '鐜妭鍚?' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '30' }	
  self.action['cgfscriptprocesssteppriceitem']['step_price'] = { ['title'] = '鐜妭浠锋牸' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppriceitem']['disable'] = { ['title'] = '1璇ョ幆鑺備笉瀛樺湪' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }	
  self.action['cgfscriptprocesssteppriceitem']['quantity'] = { ['title'] = 'quantity' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppriceitem']['son_count'] = { ['title'] = '鍒嗗崟鏁伴噺' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppriceitem']['condition'] = { ['title'] = '璁′欢鏉′欢' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppriceitem']['priority'] = { ['title'] = 'priority' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '11' }	
  self.action['cgfscriptprocesssteppriceitem']['line'] = { ['title'] = 'line' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '2' }	
  self.action['cgfscriptprocesssteppriceitem']['line_condition'] = { ['title'] = 'line_condition' , ['t'] = 's' , ['min'] = 'NaN' , ['max'] = '255' }	
  self.action['cgfscriptprocesssteppriceitem']['disable_sub'] = { ['title'] = 'disable_sub' , ['t'] = 'n' , ['min'] = 'NaN' , ['max'] = '1' }
  self.action['cgfscriptprocesssteppriceitem']['list_source'] = { ['title'] = '' ,['t'] = 's' , ['max'] = 50 }
	
  
 
  	
  
	self.session = {}
	
end   





mcgfscriptprocesssteppricemgr.check_fields_validate = function(self,key,postparam)
	local checkfunc = {}
	checkfunc['t'] = function(fm,value)
		return true
	end
	checkfunc['min'] = function(fm,value)
		if string.len(value) < tonumber(fm) then
			return false
		end
		return true
	end
	checkfunc['max'] = function(fm,value)
		if string.len(value) > tonumber(fm) then
			return false
		end
		return true
	end
	local format = self.action[key]
	for fkey,fvalue in pairs(postparam) do
		if format[fkey] ~= nil then
			for fmkey,fmvalue in pairs(format[fkey]) do
				if checkfunc[fmkey] ~= nil then
					if checkfunc[fmkey](fmvalue,fvalue) == false then
						return false,tostring(format[fkey]['title']).." "..tostring(fmkey).." "..tostring(fmvalue).." error"
					end
				end
			end
		end
	end
	return true,""
end 


 
mcgfscriptprocesssteppricemgr.get_session = function(self,key)
	if key == nil then
		key = 'default'
	end
	return self.session[key]
end

mcgfscriptprocesssteppricemgr.has_session = function(self,key)
	if key == nil then
		key = 'default'
	end
	return self.session[key] ~= nil
end
 
 
mcgfscriptprocesssteppricemgr.add_session = function(self,key,ses)
	self.session[key] = ses
end


mcgfscriptprocesssteppricemgr.add_ui = function(self,key,ui)
	self.uis[key] = ui
end




-- todo
mcgfscriptprocesssteppricemgr.run = function(self,key,ui)
	if self.action[key] ~= nil and self.op[key] ~= nil then
		local tb = {}
		for k,v in pairs(self.action[key]) do
			if ui[k] ~= nil and type(ui[k]) == 'table' and ui[k].get_text then
				tb[k] = ui[k]:get_text()
			else
				print('run error',key,k)
			end
		end
		local success,msg = self:check_fields_validate(key,tb)
		if success then
			self.op[key](tb,ui)
		else
			ui.hostWindow:showMsg(msg)
		end		
	else
		print('run error self.action',key)
	end
end


------------------------------------------------------------------------------------


mcgfscriptprocesssteppricemgr.get_net_page = function(self,netmethon,attrs)
	local top = self	
	local discuz = GmBase.net.get_instance()
	local methon = netmethon
	if methon ~= nil and discuz[methon] then
		print('mcgfscriptprocesssteppricemgr.get_net_page ',methon)
		local tbname,callbackey,tb = discuz[netmethon](discuz)
		for k,v in pairs(attrs) do
			tb[k] = attrs[k]
		end
		discuz[netmethon](discuz,tb)
	else
		print('mcgfscriptprocesssteppricemgr.get_net_page error ',methon)
	end		
end




mcgfscriptprocesssteppricemgr.get_prev_page = function(self,ui,callback)
	if ui.page ~= nil and type(ui.page) == 'number' then
		local uiattrs = ui:GetAttrs()
		local attrs = {}
		for a,b in pairs(self.action['cgfscriptprocesssteppricelist']) do
			if type(uiattrs[a]) ~= nil then
				attrs[a] = uiattrs[a]
			end
		end
		attrs.page = ui.page - 1		

		if attrs.page < 1 then
			attrs.page = 1
		end

		self:get_net_page(ui.netmethon,attrs)
	end
end


mcgfscriptprocesssteppricemgr.get_next_page = function(self,ui,callback)
	if ui.page ~= nil and type(ui.page) == 'number' then
		local uiattrs = ui:GetAttrs()
		local attrs = {}
		for a,b in pairs(self.action['cgfscriptprocesssteppricelist']) do
			if type(uiattrs[a]) ~= nil then
				attrs[a] = uiattrs[a]
			end
		end
		attrs.page = ui.page + 1
		self:get_net_page(ui.netmethon,attrs)
	end
end

------------------------------------------------------------------------------------



mcgfscriptprocesssteppricemgr.init_table = function(self)
	--[[
	local tablefield = {}
	
	--number
	tablefield['id'] = { ["i"] = 8, }
    
	--number
	tablefield['photo_id'] = { ["i"] = 11, }
    
	--number
	tablefield['step_id'] = { ["i"] = 11, }
    
	--string
	tablefield['step_name'] = { ["v"] = 30, }
    
	--string
	tablefield['step_price'] = { ["v"] = 255, }
    
	--number
	tablefield['disable'] = { ["i"] = 1, }
    
	--string
	tablefield['quantity'] = { ["v"] = 255, }
    
	--string
	tablefield['son_count'] = { ["v"] = 255, }
    
	--string
	tablefield['condition'] = { ["v"] = 255, }
    
	--number
	tablefield['priority'] = { ["i"] = 11, }
    
	--number
	tablefield['line'] = { ["i"] = 2, }
    
	--string
	tablefield['line_condition'] = { ["v"] = 255, }
    
	--number
	tablefield['disable_sub'] = { ["i"] = 1, }
    
	self:create_table( self.tablename, tablefield)
	]]
	self:initTableStruct()
end


	